//
//  KDChooseHeadCell.m
//  LaiKeDaoClient
//
//  Created by dongkedi的iMac on 15/11/12.
//  Copyright © 2015年 LKD. All rights reserved.
//

#import "KDChooseHeadCell.h"

@implementation KDChooseHeadCell

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        _open = NO;
        
        UIButton* btn = [UIButton buttonWithType:UIButtonTypeCustom];
        btn.frame = CGRectMake(0, 0, kScreenWidth, 34);
        [btn addTarget:self action:@selector(doSelected) forControlEvents:UIControlEventTouchUpInside];
        [btn setBackgroundImage:[UIColor createImageWithColor:[UIColor whiteColor]] forState:UIControlStateNormal];
        [btn setBackgroundImage:[UIColor createImageWithColor:[UIColor colorWithHexString:@"0xF2F2F2"]] forState:UIControlStateSelected];
        [self addSubview:btn];
        self.backBtn = btn;
        
        self.nameLabel = [[UILabel alloc] initWithFrame:(CGRect){17,12,200,14}];
        [_nameLabel setTextAlignment:NSTextAlignmentLeft];
        [_nameLabel setFont:[UIFont systemFontOfSize:13]];
        [_nameLabel setBackgroundColor:[UIColor clearColor]];
        [_nameLabel setText:@"标题"];
        [self addSubview:_nameLabel];
        
       self.backImageView = [[UIImageView alloc] initWithFrame:(CGRect){kScreenWidth-11-14,14,11,6}];
        [self.backImageView setImage:[UIImage imageNamed:@"btn_open@2X.png"]];
        [self.backImageView setUserInteractionEnabled:YES];
        [self addSubview:self.backImageView];
        
        UIView  *line = [[UIView alloc] initWithFrame:(CGRect){0,34,kScreenWidth,1}];
        [line setBackgroundColor:[UIColor colorWithHexString:@"0xE0E0E0"]];
        [self addSubview:line];
    }
    return self;
}

-(void)doSelected{
    //    [self setImage];
    if (_delegate && [_delegate respondsToSelector:@selector(selectedWith:)]){
        [_delegate selectedWith:self];
    }
}

@end
